package com.androidhive.androidlistview;

import java.util.HashMap;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;

public class FarmerProfile extends Activity {
	SessionManager session;
	DatabaseHandler db=new DatabaseHandler(this);
	String FProfile=new String();
	String [] res=new String[]{};
	 public final static String NAME = "com.example.sample.MESSAGE";
	 public final static String CNU = "com.example.sample.MESSAGE";
	 public final static String EID= "com.example.sample.MESSAGE";
	 public final static String FLOC = "com.example.sample.MESSAGE";
	 
	 String fNAME=new String();
	
	 String fCNU=new String();
	 String fEID=new String();
	 String fFLOC=new String();
	 String fFSTATE=new String();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_farmer_profile);
		session = new SessionManager(getApplicationContext());
	    HashMap<String, String> user = session.getUserDetails();
	    String farmerId = (user.get(SessionManager.Vendor_Id)); 
      
		TextView heading= (TextView)findViewById(R.id.textView6);
		
	    //textView6
		TextView name = (TextView)findViewById(R.id.textView8);
		TextView cnu = (TextView)findViewById(R.id.TextView01);
		TextView eid = (TextView)findViewById(R.id.TextView03);
		TextView floc = (TextView)findViewById(R.id.TextView02);
		TextView fstate = (TextView)findViewById(R.id.TextView04);
		Log.d("Farmer",farmerId);
		
		   Intent intent = getIntent();
		    String cropId = intent.getStringExtra(MyWebviewFarmer.cropId);
		
		int FId=db.getFarmerId(Integer.parseInt(cropId));
		FProfile=db.getFarmerProfile(FId);
		Log.d("Sucess","1");
		
		
		res=FProfile.split("#");
			fNAME=res[0];
			fCNU=res[1];
			fEID=res[2];
			Log.d("Sucess","2");
			fFLOC=res[3];
			fFSTATE=res[4];
			Log.d("Sucess","3");
		//heading.setText("Welcome "+fNAME+"!!!!");
		name.setText(fNAME);
		cnu.setText(fCNU);
		eid.setText(fEID);
		floc.setText(fFLOC);
		fstate.setText(fFSTATE);
		Log.d("Sucess","4");
		
		
		// Show the Up button in the action bar.
	
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_fviewprofile, menu);
		return true;
	}

	
	

}
